<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">UV价值</ui:define>
    <ui:define name="content">
        <h:form>
            <p:defaultCommand target="search"/>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton update="@form" id="search" value="查询" icon="fa fa-search"/>
                        <p:commandButton value="重置" icon="fa fa-refresh"/>
                        <p:commandButton value="导出" icon="fa fa-download"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-g ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12 ">
                    <div class="ui-g-12 card">
                        <h1>查询条件</h1>
                        <div class="ui-g-1">
                            <p:outputLabel value="结算日期"/>
                        </div>
                        <div class="ui-g-3">
                            <p:calendar value="#{settlementUvReportBean.$.beginDate}"
                                        id="startTime" styleClass="autoWidthCalendar"
                                        locale="#{constants:get('LOCALE')}"
                                        timeZone="#{constants:get('TIME_ZONE')}"
                                        pattern="#{constants:get('DATE_FORMAT')}"/>
                            <span>—</span>
                            <p:calendar value="#{settlementUvReportBean.$.endDate}"
                                        id="recordEndTime" styleClass="autoWidthCalendar"
                                        locale="#{constants:get('LOCALE')}"
                                        timeZone="#{constants:get('TIME_ZONE')}"
                                        pattern="#{constants:get('DATE_FORMAT')}"/>
                        </div>
                        <div class="ui-g-1">
                            <p:outputLabel value="公司名称"/>
                        </div>
                        <div class="ui-g-3">
                            <p:selectOneMenu id="companyName" value="#{settlementUvReportBean.$.companyId}" filter="true"
                                             filterMatchMode="contains">
                                <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                <f:selectItems value="#{settlementUvReportBean.companyInfoList}" var="company"
                                               itemLabel="#{company.companyName}" itemValue="#{company.id}"/>
                            </p:selectOneMenu>
                        </div>

                        <div class="ui-g-1">
                            <p:outputLabel value="产品名称"/>
                        </div>
                        <div class="ui-g-3">
                            <p:selectOneMenu id="productName" value="#{settlementUvReportBean.$.productId}" filter="true"
                                             filterMatchMode="contains">
                                <f:selectItem itemLabel="- 请选择 -" itemValue="" noSelectionOption="true"/>
                                <f:selectItems value="#{settlementUvReportBean.productInfoList}" var="product"
                                               itemLabel="#{product.name}" itemValue="#{product.id}"/>
                            </p:selectOneMenu>
                        </div>
                        <div class="ui-g-1">
                            <p:outputLabel value="产品分组"/>
                        </div>
                        <div class="ui-g-3">
                            <p:selectOneMenu id="isGroup" value="#{settlementUvReportBean.$.isGroup}">
                                <f:selectItem itemLabel="是" itemValue="1"/>
                                <f:selectItem itemLabel="否" itemValue="0"/>
                            </p:selectOneMenu>
                        </div>
                    </div>
                </div>
                <div class="ui-g-12">
                    <div class="ui-g-12 card">
                        <h1>查询结果</h1>
                        <p:dataTable id="userDataTable"
                                     style="width: 100%"
                                     var="uv"
                                     value="#{settlementUvReportBean.lazyDataModel}"
                                     rows="#{constants:get('ROWS')}"
                                     lazy="true"
                                     paginator="true"
                                     paginatorTemplate="#{constants:get('PAGINATOR_TEMPLATE')}"
                                     rowsPerPageTemplate="#{constants:get('ROWS_PER_PAGE_TEMPLATE')}"
                                     emptyMessage="#{constants:get('EMPTY_MESSAGE')}"
                                     scrollable="true"
                                     scrollWidth="97%"
                                     reflow="true"
                                     selection=""
                                     resizableColumns="true">
                            <p:column headerText="日期">
                                <h:outputText value="#{uv.beginDate}">
                                    <f:convertDateTime pattern="yyyy-MM-dd"/>
                                </h:outputText>
                            </p:column>
                            <p:column headerText="公司名称">
                                <h:outputText value="#{uv.companyName}"/>
                            </p:column>
                            <p:column headerText="产品名称">
                                <h:outputText value="#{uv.productName==null?'全部':uv.productName}"/>
                            </p:column>
                            <p:column headerText="参与UV">
                                <h:outputText value="#{uv.participateUv}"/>
                            </p:column>
                            <p:column headerText="UV价值">
                                <h:outputText value="#{uv.uvValue}"/>
                            </p:column>
                        </p:dataTable>
                    </div>

                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>
